from linked_list import *


if __name__ == "__main__":
    nums = [1, 2, 3]
    gen_linked_list = CreateLinkList(nums)
    linklist_tail = gen_linked_list.rear()  # 结果为 1 -> 2 -> 3
    linklist_head = gen_linked_list.head()  # 结果为 3 -> 2 -> 1
    print('尾插法创建链表结果：')
    print_linklist(linklist_tail)
    print('\n---------------------------------')
    print('头插法创建链表结果：')
    print_linklist(linklist_head)
    print('\n---------------------------------')
    print('用迭代法翻转链表：')
    rev_linklist_iter = reverse_iterative(linklist_tail)
    print_linklist(rev_linklist_iter)
    print('\n---------------------------------')
    print('用递归法翻转链表：')
    rev_linklist_rec = reverse_recursive(linklist_head)
    print_linklist(rev_linklist_rec)
